package com.bookmanagement.controller.user;


import com.bookmanagement.result.PageResult;
import com.bookmanagement.result.Result;
import com.bookmanagement.service.CollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author skyjay
 */
@RestController
@RequestMapping("/collection")
public class CollectionController {

    @Autowired
    private CollectionService collectionService;

    @GetMapping("/list")
    public Result<PageResult> getCollection(){
        PageResult pageResult = collectionService.getCollection();
        return Result.success(pageResult);
    }

    @PostMapping("/{id}")
    public Result addCollection(@PathVariable("id") Integer bookId){
        collectionService.isCollection(bookId);
        return Result.success();
    }

}
